home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 3006 / 3006.xpi / chrome / dwhelper.jar / content / converter-queue.xml < prev    next >
Extensible Markup Language  |  2010-01-15  |  12KB  |  350 lines

  1. <?xml version="1.0"?>
  2. <!-- *****************************************************************************
  3.  *            Copyright (c) 2006-2009 Michel Gutierrez. All Rights Reserved.
  4.  ****************************************************************************** -->
  5.  
  6. <!DOCTYPE bindings SYSTEM "chrome://dwhelper/locale/dwhelper.dtd" >
  7.  
  8. <bindings xmlns="http://www.mozilla.org/xbl"
  9.     xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  10.     xmlns:html="http://www.w3.org/1999/xhtml"
  11.     xmlns:xbl="http://www.mozilla.org/xbl">
  12.  
  13.     <binding id="ConverterQueue" extends="widgets.xml#widget">
  14.  
  15.         <xbl:content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  16.             <vbox
  17.                 anonid="xList"
  18.                 datasources="rdf:null" 
  19.                 ref="urn:root"
  20.                 context="_child"
  21.                 class="dwhelper-converter-queue-container"
  22.                 flex="1"
  23.                 >
  24.                 <template>
  25.                     <rule>
  26.                         <conditions>
  27.                             <content uri="?root"/>
  28.                             <member container="?root" child="?conversion"/>  
  29.                             <triple subject="?conversion"
  30.                                     predicate="http://downloadhelper.net/1.0#Status"
  31.                                     object="2"/>
  32.                             <triple subject="?conversion"
  33.                                     predicate="http://downloadhelper.net/1.0#InputFilePath"
  34.                                     object="?InputFilePath"/>
  35.                             <triple subject="?conversion"
  36.                                     predicate="http://downloadhelper.net/1.0#InputFilePathShort"
  37.                                     object="?InputFilePathShort"/>
  38.                             <triple subject="?conversion"
  39.                                     predicate="http://downloadhelper.net/1.0#OutputFilePath"
  40.                                     object="?OutputFilePath"/>
  41.                             <triple subject="?conversion"
  42.                                     predicate="http://downloadhelper.net/1.0#OutputFilePathShort"
  43.                                     object="?OutputFilePathShort"/>
  44.                             <triple subject="?conversion"
  45.                                     predicate="http://downloadhelper.net/1.0#CreationDate"
  46.                                     object="?CreationDate"/>
  47.                         </conditions>
  48.                         <action>
  49.                             <vbox uri="?conversion" class="dwhelper-converter-queue-entry">
  50.                                 <grid flex="1">
  51.                                     <columns>
  52.                                         <column/>
  53.                                         <column flex="1"/>
  54.                                     </columns>
  55.                                     <rows>
  56.                                         <row>
  57.                                             <label value="&label.converter-queue.status;"/>
  58.                                             <label value="&label.converter-queue.status.waiting;"/>
  59.                                         </row>
  60.                                         <row>
  61.                                             <label value="&label.converter-queue.started-on;"/>
  62.                                             <label value="?CreationDate"/>
  63.                                         </row>
  64.                                         <row>
  65.                                             <label value="&label.converter-queue.input;"/>
  66.                                             <label value="?InputFilePathShort" tooltiptext="?InputFilePath"/>
  67.                                         </row>
  68.                                         <row>
  69.                                             <label value="&label.converter-queue.output;"/>
  70.                                             <label value="?OutputFilePathShort" tooltiptext="?OutputFilePath"/>
  71.                                         </row>
  72.                                     </rows>
  73.                                 </grid>
  74.                             </vbox>
  75.                         </action>
  76.                     </rule>
  77.  
  78.                     <rule>
  79.                         <conditions>
  80.                             <content uri="?root"/>
  81.                             <member container="?root" child="?conversion"/>  
  82.                             <triple subject="?conversion"
  83.                                     predicate="http://downloadhelper.net/1.0#Status"
  84.                                     object="5"/>
  85.                             <triple subject="?conversion"
  86.                                     predicate="http://downloadhelper.net/1.0#InputFilePath"
  87.                                     object="?InputFilePath"/>
  88.                             <triple subject="?conversion"
  89.                                     predicate="http://downloadhelper.net/1.0#InputFilePathShort"
  90.                                     object="?InputFilePathShort"/>
  91.                             <triple subject="?conversion"
  92.                                     predicate="http://downloadhelper.net/1.0#OutputFilePath"
  93.                                     object="?OutputFilePath"/>
  94.                             <triple subject="?conversion"
  95.                                     predicate="http://downloadhelper.net/1.0#OutputFilePathShort"
  96.                                     object="?OutputFilePathShort"/>
  97.                             <triple subject="?conversion"
  98.                                     predicate="http://downloadhelper.net/1.0#EndDate"
  99.                                     object="?EndDate"/>
  100.                         </conditions>
  101.                         <bindings>
  102.                             <binding subject="?conversion"
  103.                                     predicate="http://downloadhelper.net/1.0#ErrorMessage"
  104.                                     object="?ErrorMessage"/>
  105.                         </bindings>
  106.                         <action>
  107.                             <vbox uri="?conversion" class="dwhelper-converter-queue-entry">
  108.                                 <grid flex="1">
  109.                                     <columns>
  110.                                         <column/>
  111.                                         <column flex="1"/>
  112.                                     </columns>
  113.                                     <rows>
  114.                                         <row>
  115.                                             <label value="&label.converter-queue.status.error;"/>
  116.                                              <description value="?ErrorMessage"/>
  117.                                         </row>
  118.                                         <row>
  119.                                             <label value="&label.converter-queue.ended-on;"/>
  120.                                             <label value="?EndDate"/>
  121.                                         </row>
  122.                                         <row>
  123.                                             <label value="&label.converter-queue.input;"/>
  124.                                             <label value="?InputFilePathShort" tooltiptext="?InputFilePath"/>
  125.                                         </row>
  126.                                         <row>
  127.                                             <label value="&label.converter-queue.output;"/>
  128.                                             <label value="?OutputFilePathShort" tooltiptext="?OutputFilePath"/>
  129.                                         </row>
  130.                                     </rows>
  131.                                 </grid>
  132.                             </vbox>
  133.                         </action>
  134.                     </rule>
  135.  
  136.                     <rule>
  137.                         <conditions>
  138.                             <content uri="?root"/>
  139.                             <member container="?root" child="?conversion"/>  
  140.                             <triple subject="?conversion"
  141.                                     predicate="http://downloadhelper.net/1.0#Status"
  142.                                     object="4"/>
  143.                             <triple subject="?conversion"
  144.                                     predicate="http://downloadhelper.net/1.0#InputFilePath"
  145.                                     object="?InputFilePath"/>
  146.                             <triple subject="?conversion"
  147.                                     predicate="http://downloadhelper.net/1.0#InputFilePathShort"
  148.                                     object="?InputFilePathShort"/>
  149.                             <triple subject="?conversion"
  150.                                     predicate="http://downloadhelper.net/1.0#OutputFilePath"
  151.                                     object="?OutputFilePath"/>
  152.                             <triple subject="?conversion"
  153.                                     predicate="http://downloadhelper.net/1.0#OutputFilePathShort"
  154.                                     object="?OutputFilePathShort"/>
  155.                             <triple subject="?conversion"
  156.                                     predicate="http://downloadhelper.net/1.0#EndDate"
  157.                                     object="?EndDate"/>
  158.                         </conditions>
  159.                         <action>
  160.                             <vbox uri="?conversion" class="dwhelper-converter-queue-entry">
  161.                                 <grid flex="1">
  162.                                     <columns>
  163.                                         <column/>
  164.                                         <column flex="1"/>
  165.                                     </columns>
  166.                                     <rows>
  167.                                         <row>
  168.                                             <label value="&label.converter-queue.status;"/>
  169.                                             <label value="&label.converter-queue.status.done;"/>
  170.                                         </row>
  171.                                         <row>
  172.                                             <label value="&label.converter-queue.ended-on;"/>
  173.                                             <label value="?EndDate"/>
  174.                                         </row>
  175.                                         <row>
  176.                                             <label value="&label.converter-queue.input;"/>
  177.                                             <label value="?InputFilePathShort" tooltiptext="?InputFilePath"/>
  178.                                         </row>
  179.                                         <row>
  180.                                             <label value="&label.converter-queue.output;"/>
  181.                                             <label value="?OutputFilePathShort" tooltiptext="?OutputFilePath"/>
  182.                                         </row>
  183.                                     </rows>
  184.                                 </grid>
  185.                             </vbox>
  186.                         </action>
  187.                     </rule>
  188.  
  189.                     <rule>
  190.                         <conditions>
  191.                             <content uri="?root"/>
  192.                             <member container="?root" child="?conversion"/>  
  193.                             <triple subject="?conversion"
  194.                                     predicate="http://downloadhelper.net/1.0#Status"
  195.                                     object="3"/>
  196.                             <triple subject="?conversion"
  197.                                     predicate="http://downloadhelper.net/1.0#InputFilePath"
  198.                                     object="?InputFilePath"/>
  199.                             <triple subject="?conversion"
  200.                                     predicate="http://downloadhelper.net/1.0#InputFilePathShort"
  201.                                     object="?InputFilePathShort"/>
  202.                             <triple subject="?conversion"
  203.                                     predicate="http://downloadhelper.net/1.0#OutputFilePath"
  204.                                     object="?OutputFilePath"/>
  205.                             <triple subject="?conversion"
  206.                                     predicate="http://downloadhelper.net/1.0#OutputFilePathShort"
  207.                                     object="?OutputFilePathShort"/>
  208.                             <triple subject="?conversion"
  209.                                     predicate="http://downloadhelper.net/1.0#CreationDate"
  210.                                     object="?CreationDate"/>
  211.                         </conditions>
  212.                         <bindings>
  213.                             <binding subject="?conversion"
  214.                                     predicate="http://downloadhelper.net/1.0#Progress"
  215.                                     object="?Progress"/>
  216.                             <binding subject="?conversion"
  217.                                     predicate="http://downloadhelper.net/1.0#ProgressMode"
  218.                                     object="?ProgressMode"/>
  219.                         </bindings>
  220.                         <action>
  221.                             <vbox uri="?conversion" class="dwhelper-converter-queue-entry">
  222.                                 <grid flex="1">
  223.                                     <columns>
  224.                                         <column/>
  225.                                         <column flex="1"/>
  226.                                     </columns>
  227.                                     <rows>
  228.                                         <row>
  229.                                             <label value="&label.converter-queue.status;"/>
  230.                                             <label value="&label.converter-queue.status.inprogress;"/>
  231.                                         </row>
  232.                                         <row>
  233.                                             <label value="&label.converter-queue.started-on;"/>
  234.                                             <label value="?CreationDate"/>
  235.                                         </row>
  236.                                         <row>
  237.                                             <label value="&label.converter-queue.input;"/>
  238.                                             <label value="?InputFilePathShort" tooltiptext="?InputFilePath"/>
  239.                                         </row>
  240.                                         <row>
  241.                                             <label value="&label.converter-queue.output;"/>
  242.                                             <label value="?OutputFilePathShort" tooltiptext="?OutputFilePath"/>
  243.                                         </row>
  244.                                         <row>
  245.                                             <spacer/>
  246.                                             <progressmeter
  247.                                                 mode="?ProgressMode"
  248.                                                 value="?Progress"/>
  249.                                         </row>
  250.                                     </rows>
  251.                                 </grid>
  252.                             </vbox>
  253.                         </action>
  254.                     </rule>
  255.  
  256.                 </template>
  257.                 
  258.             </vbox>
  259.             <children style="display: none;"/>
  260.         </xbl:content>
  261.  
  262.         <implementation>
  263.  
  264.             <constructor>
  265.                 <![CDATA[
  266. var props=this.convertMgr.getInfo();
  267. var method=props.get("method",Components.interfaces.nsISupportsPRInt32).data;
  268.  
  269. this.datasource=this.convertMgr.getQueueDataSource();    
  270. this.util.setDatasource(this.xList,this.datasource);
  271.                 ]]>
  272.             </constructor>
  273.  
  274.             <destructor>
  275.                 <![CDATA[
  276. if(this.pollTimer) {
  277.     window.clearTimeout(this.pollTimer);
  278.     this.convKey.close();
  279. }
  280.                 ]]>
  281.             </destructor>
  282.  
  283.             <method name="updateQueue">
  284.                 <body>
  285.                 <![CDATA[
  286.  
  287.  
  288. this.datasource.beginUpdateBatch();
  289. var keys={};
  290. var file=Components.classes["@mozilla.org/file/local;1"].
  291.         createInstance(Components.interfaces.nsILocalFile);
  292. for(var i=0;i<this.convKey.childCount;i++) {
  293.     var keyName=this.convKey.getChildName(i);
  294.     var resKeyName=this.NS+"converter-queue-"+keyName;
  295.     keys[resKeyName]="";
  296.     var key=this.convKey.openChild(keyName,this.convKey.ACCESS_READ);
  297.     this.util.createNodeSS(this.datasource,"urn:root",resKeyName);
  298.     var path=key.readStringValue("InputFilePath");
  299.     file.initWithPath(path);
  300.     this.util.setPropertyValueSS(this.datasource,resKeyName,this.NS+"InputFilePath",
  301.         path);
  302.     this.util.setPropertyValueSS(this.datasource,resKeyName,this.NS+"InputFilePathShort",
  303.         file.leafName);
  304.     path=key.readStringValue("OutputFilePath");
  305.     file.initWithPath(path);
  306.     this.util.setPropertyValueSS(this.datasource,resKeyName,this.NS+"OutputFilePath",
  307.         path);
  308.     this.util.setPropertyValueSS(this.datasource,resKeyName,this.NS+"OutputFilePathShort",
  309.         file.leafName);
  310.     this.util.setPropertyValueSS(this.datasource,resKeyName,this.NS+"Status",
  311.         ""+key.readIntValue("Status"));
  312.     this.util.setPropertyValueSS(this.datasource,resKeyName,this.NS+"Progress",
  313.         ""+key.readIntValue("Progress"));
  314.     try {
  315.         this.util.setPropertyValueSS(this.datasource,resKeyName,this.NS+"ErrorMessage",
  316.             key.readStringValue("ErrorMessage"));
  317.     } catch(e) {}
  318.     key.close();
  319. }
  320.  
  321. var keys0=this.util.getChildResourcesS(this.datasource,"urn:root",{});
  322. for(var i=0;i<keys0.length;i++) {
  323.     if(keys[keys0[i].Value]==null) {
  324.         this.util.removeReference(this.datasource,keys0[i]);
  325.     }
  326. }
  327. this.datasource.endUpdateBatch();
  328.  
  329.  
  330.                 ]]>
  331.                 </body>
  332.             </method>
  333.             
  334.         </implementation>
  335.         
  336.         <handlers>
  337.             
  338.             <!-- 
  339.             <handler event="DOMAttrModified">
  340.                 <![CDATA[
  341.                 ]]>
  342.             </handler>
  343.              -->
  344.     
  345.         </handlers>
  346.  
  347.     </binding>
  348.  
  349. </bindings>
  350.